import request from '@/utils/request'

const axios = require('axios').default

const instance = axios.create({
  baseURL: 'http://www.pvp1199.com/api',
  // baseURL: 'http://192.168.5.3:50004/api',
  timeout: 5000
})

export function getList(query) {
  return request({
    url: '/goods/list',
    method: 'get',
    params: query
  })
}

export function setLoop(id, loop) {
  return request.post(`/goods/${id}/loop?loop=${loop}`)
}

export function getOrderId(group_id, normal_price, goods_id, sku_id) {
  return instance({
    url: '/Order/getGroupId',
    method: 'get',
    params: { group_id, normal_price, goods_id, sku_id }
  })
}

export function setOrderId(id, groupOrderId) {
  return request.post(`/goods/${id}/groupOrderId`, { groupOrderId })
}
